package com.ffcs.crmd.tsp.admin.control;

import javax.servlet.http.HttpSession;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ctg.itrdc.platform.common.entity.PageInfo;
import com.ctg.itrdc.platform.common.exception.ExceptionUtil;
import com.ffcs.crmd.platform.pub.vo.RetVo;
import com.ffcs.crmd.tsp.admin.api.dto.TaskConnectInfoDTO;
import com.ffcs.crmd.tsp.admin.api.facade.ITaskConnectInfoFacade;

/**
 * 
 * 功能说明:执行端连接信息控制层
 *
 * @author ZHONGFUHUA
 * 
 * @Date 2016年2月16日 下午4:49:00
 *
 *
 *       版本号 | 作者 | 修改时间 | 修改内容
 *
 */
@Controller
@ResponseBody
@RequestMapping("/tsp/taskConnectInfo")
public class TaskConnectInfoController {
    
    private final Logger           logger = LoggerFactory.getLogger(TaskConnectInfoController.class);
    
    @Autowired
    private ITaskConnectInfoFacade taskConnectInfoFacade;
    
    /**
     * 
     * 功能说明:分页查询执行端连接数
     * 
     * @author ZHONGFUHUA
     *
     * @Date 2016年2月17日
     *
     */
    @RequestMapping(value = "/queryPage")
    public RetVo queryPage(ModelMap map, HttpSession httpSession, @RequestBody TaskConnectInfoDTO taskConnectInfoDto) {
        RetVo retVo = new RetVo(true);
        try {
            PageInfo<TaskConnectInfoDTO> pageInfo = taskConnectInfoFacade.queryPage(taskConnectInfoDto);
            retVo.setPageInfo(pageInfo);
        } catch (Exception e) {
            logger.error("Task Connect Info Action : query task connect info page by job exception:", e);
            retVo.setResult(false);
            retVo.setMsgTitle(e.getMessage());
            retVo.setDetailMsg(ExceptionUtil.getTraceInfo(e));
        }
        return retVo;
    }
    
}
